//Quadrant class - holds information for Quadrants:
// 2D array of sprites(sectors)
// array of enemies
// number of enemies within the quadrant
// number of stations
// number of stars
// Current state
// if its been scannned/explored



#pragma once

#include <cstdlib>
#include <cmath>
#include <ctime>

#include <iostream>
using namespace std ;

#include "Enemy.h"

#define MAX_ENEMIES 3

struct LRSInfo	//Struct of quadrant scanning information
{
	bool m_station;						//??
	
	int m_numStars;						//number of stars in the quadrant
	int m_numEnemies;					//numberof enemies in the quadrant

};


enum QuadrantState
{
	GREEN,
	YELLOW,
	RED,
};

enum UnitType
{
	EMPTY,
	PLAYER,
	ENEMY,
	STAR,
	MISSILE,
	STATION
} ;

class Quadrant
{
private:
	
	QuadrantState m_QState;				//current state GREEN/YELLOW/RED
	
	//m_Qstatus;						//Quadrant status ??
	
	//64 different sectors per quadrant, having particular unit type
	UnitType sector[8][8] ;

	LRSInfo m_lrsInfo;					//holds info for quadrants

	bool m_explored;					//whether or not the quadrant has been visited/scanned
	bool m_station ;
	bool m_EnemyAttacking ;

	//whether or not the player is in this quadrant
	bool m_hasPlayer ;
	bool m_justWarped ;

	Enemy *m_enemies[MAX_ENEMIES];

public:
	Quadrant();
	~Quadrant();

	//Gets the current sector data
	int GetSector( int x, int y ) { return sector[x][y] ; }

	Enemy* FindEnemy( int x, int y ) ;

	bool EnemyIsAttacking( ) ;

	//Update Enemy on its turn
	void UpdateEnemy( ) ;

	//Enemy gets damaged by the player
	void DamageEnemies( int energy, int b_PosX, int b_PosY ) ;

	//when player enters a quadrant or at initialization
	void RandomizeQuadrant( ) ;

	//get player and missile data to update the quadrant sector
	void SetPlayer( int x, int y ) { sector[x][y] = PLAYER ; }
	void SetMissile( int x, int y ) { sector[x][y] = MISSILE ; }

	//turns the bool on/off when player leaves/enters quadrant
	void PlayerExist( ) ;

	void DestroyEnemy( bool isTarget, int dist, int x, int y ) ;

	void EmptySector( int x, int y ) {sector[x][y] = EMPTY ;}

	//sets/gets the state of the quadrant
	void setState(QuadrantState a_state)	{	m_QState = a_state;	}
	QuadrantState getState()				{	return m_QState;	}
	
	//sets/gets the state of the quadrant being explored
	void setExplored(bool a_expl)			{	m_explored = a_expl;}
	bool getExplored()						{	return m_explored;	}

	//sets/gets the information of the quadrant
	void setLRS(bool a_stat, int a_stars, int a_nmes);
	LRSInfo getLRSScan()						{	return m_lrsInfo;	}

	//void setStars(int a_stars)				{	m_numStars = a_stars;}
	//int getStars()							{	return m_numStars;	}

	//void setEnemies(int a_nmes)				{	m_numEnemies = a_nmes;}
	//int getEnemies()						{	return m_numEnemies;}

	//void UpdateQuad();

};